package com.rhythms.swiperecyclerview.utils;

import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;


public class RhythmsSpUtil {

    private static SharedPreferences sharedPreferences;


    //保存全局配置
    public static void saveData(String strSettings, Context context){
        Log.i("languagetest", "saveGlobalSettings: strSettings*******====" + strSettings);
        getInstances(context).edit().putString(RhythmsStaticConstants.RHYTHMSEDITCONFIG,strSettings).apply();
    }
    public static String getData(Context context){
        String strSettings = getInstances(context).getString(RhythmsStaticConstants.RHYTHMSEDITCONFIG, "");
        Log.i("languagetest", "getGlobalSettings: strSettings--++++=====" + strSettings);
        return strSettings;
    }

    private static SharedPreferences getInstances(Context context){
        if (sharedPreferences==null){
            return  sharedPreferences = context.getSharedPreferences(RhythmsStaticConstants.HSBALLAPPSHAREPREF, Context.MODE_PRIVATE);
        }
        return sharedPreferences;
    }

}